<cfcomponent displayname="CrafterMediaEmbedItem" accessors="yes" output="no" hint="Represents a standard media embed item inside the Full Sail / Crafter universe.">


	<!--- Properties --->
	<cfproperty name="code" type="string" default="" />
	<cfproperty name="embedHTML" type="string" default="" />
	<cfproperty name="alfrescoRoot" type="string" default="" />
	<cfproperty name="isLoaded" type="boolean" default="false" />
	
	
	<!--- init() --->
	<cffunction name="init" access="public" returntype="any" output="no">
		<cfargument name="rootPath" type="string" required="yes" />
		<cfscript>
			setCode("");
			setEmbedHTML("");
			setAlfrescoRoot(arguments.rootPath);
			setIsLoaded(false);
			return this;
		</cfscript>
	</cffunction>
	
	
	<!--- loadFromXml() --->
	<cffunction name="loadFromXml" access="public" returntype="any" output="no">
		<cfargument name="oXML" type="any" required="yes" />
		
		<cfscript>
			setCode(arguments.oXml.xmlChildren[1].XmlText);
			setEmbedHTML(XmlSearch(arguments.oXml,"//mediaSetEmbedItem[code='#getCode()#']/embedHTML")[1].XmlText);
			setIsLoaded(true);
			return this;
		</cfscript>
	</cffunction>
	
	
	<!--- getRootPath() --->
	<cffunction name="getRootPath" access="public" returntype="string" output="no">
		<cfreturn getAlfrescoRoot() />
	</cffunction>

	
</cfcomponent>